package com.cn.transfer.handle.impl.redis;

import cn.hutool.json.JSONUtil;
import com.cn.transfer.common.enumeration.MessageEnum;
import com.cn.transfer.common.redis.RedisUtil;
import com.cn.transfer.common.vo.MessagePushVO;
import com.cn.transfer.handle.MessageStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author: 向伟典
 * @date: 2023/8/29 14:42
 * @Description: temp_auth_code存入redis
 */
@Component
public class TempAuthCodeRedisImpl implements MessageStrategy {
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public void handle(MessagePushVO message) {
        Map<String, Object> jsonStr = message.getBizContent();
        String bizContent = JSONUtil.toJsonStr(jsonStr);
        redisUtil.set(MessageEnum.TEMP_AUTH_CODE.getChinese(), bizContent, 600);
    }

    @Override
    public String getMsgType() {
        return "TEMP_AUTH_CODE";
    }
}
